package org.shoukaiseki.inittable.utils;

/**
 *
 **/
public class TableTriggerInfoUtils {


    public static TableTriggerInfoBuilder rowstampTriggerBuilderFromTableName(String tableName){
        String triggerName=tableName+"_rowstamp";
        return rowstampTriggerBuilderFromTableName(tableName,triggerName);
    }

    public static TableTriggerInfoBuilder rowstampTriggerBuilderFromTableName(String tableName,String triggerName){
        return TableTriggerInfoBuilder.triggerName(triggerName).triggerSql("create trigger "+triggerName+" before update on "+tableName+" FOR EACH ROW begin set @rowstamp = old.rowstamp; set NEW.rowstamp = @rowstamp + 1; end;");

    }

}
